<?php

use yii\grid\GridView;
use yii\helpers\Html;
use yii\web\JsExpression;

/**
 * @var $this         yii\web\View
 * @var $searchModel  backend\modules\content\models\search\ArticleSearch
 * @var $dataProvider yii\data\ActiveDataProvider
 */

$this->title = Yii::t('backend', 'Es-log');

$this->params['breadcrumbs'][] = $this->title;

?>

<p>
    <?php echo Html::a(Yii::t('backend', 'Clear'), false, ['class' => 'btn btn-danger', 'data-method' => 'delete']) ?>
</p>

<?php echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'options' => [
        'class' => 'grid-view table-responsive',
    ],
    'columns' => [
        [
            'attribute' => 'id',
            'value' => function ($model) {
                return $model['_id'];
            },
            'options' => ['style' => 'width: 15%'],
        ],
        [
            'attribute' => 'category',
            'value' => function ($model) {

                return $model['_source']['category'];
            },
            'options' => ['style' => 'width: 5%'],
        ],
        [
            'attribute' => 'level',
            'value' => function ($model) {
                return $model['_source']['level'];
            },
            'options' => ['style' => 'width: 15%'],
        ],
        [
            'attribute' => 'timestamp',
            'options' => ['style' => 'width: 10%'],
            'value' => function ($model) {

                return $model['_source']['@timestamp'];
            },
        ],
        [
            'attribute' => 'trace',
            'options' => ['style' => 'width: 10%'],
            'value' => function ($model) {
                return var_export($model['_source']['trace'],true);
            },
        ],
    ],
]); ?>
